package com.y4oung.service.impl;

import java.util.List;

import com.y4oung.dao.IUserDao;
import com.y4oung.model.User;
import com.y4oung.service.IUserService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userService")
public class UserServiceImpl implements IUserService{

    @Resource
    private IUserDao userDao;
    User user = new User();
    
    public boolean register(String phone,String userName,String password) {   	   	
    	user.setPhone(phone);
    	user.setName(userName);
    	user.setPassword(password);
    	return(userDao.register(user));
    }
    
    public User login(String phone) {
    	return userDao.login(phone);
    }
    
    public List<User> showUser(){
    	return userDao.showUser();
    }

    public User getUserInfo(int uid) {
        return userDao.getUserInfo(uid);
    }

    public void updateUser(int id,String name,String icon,String phone,
                           String email,String password,String message,String city){
        user.setId(id);
        user.setName(name);
        user.setIcon(icon);
        user.setPhone(phone);
        user.setEmail(email);
        user.setPassword(password);
        user.setMessage(message);
        user.setCity(city);
        userDao.updateUser(user);
    }
}
